package mao.redis.jedisdelayqueue;

import java.util.Random;

/**
 * @author Totoro
 * @date 2020/5/28
 * @explain:
 */
public class Producer implements Runnable {

    private static Random random = new Random(47);
    public RedisDelayQueue queue;

    public Producer(RedisDelayQueue queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            String msg = Thread.currentThread().getName()+" " +String.valueOf(random.nextInt());
            queue.put(String.valueOf(msg));
            System.out.println(Thread.currentThread().getName()+"produce msg :  "+msg);
        }
    }
}
